
const { prop,last, flowRight } = require("lodash/fp");

const cars = [
  {
    name: "name1",
    horsepower: 6601,
    dollar_value: 700006,
    in_stock: true,
  },
  {
    name: "name2",
    horsepower: 6602,
    dollar_value: 700007,
    in_stock: false,
  },
  {
    name: "name3",
    horsepower: 6603,
    dollar_value: 700008,
    in_stock: false,
  },
  {
    name: "name4",
    horsepower: 6604,
    dollar_value: 700009,
    in_stock: true,
  },
  {
    name: "name5",
    horsepower: 6605,
    dollar_value: 7000010,
    in_stock: true,
  },
];

const isLastInStock = flowRight(prop("in_stock"),last);

console.log(isLastInStock(cars));